// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::fs;

fn main() {
    tauri::Builder::default()
        // .setup(|app| {
        //     let window = app.get_window("main").unwrap();
        //     // set_shadow(&window, true).expect("xxx");
        //     Ok(())
        // })
        .invoke_handler(tauri::generate_handler![test1, read_me])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

#[tauri::command]
fn test1(name: &str) -> String {
    let result = format!("Hello, {}!", name);
    result
}

#[tauri::command]
fn read_me() -> String {
    fs::read_to_string("../README.md").unwrap_or("file can't read".to_string())
}